SHELL = @SHELL@
CC    = @CC@
F77   = @F77@
CXX   = @CXX@
F90   = @F90@
MAKE  = @MAKE@
LIBS  = @LIBS@
MPIRUN= @MPIRUN@
NP_ARG= @NP_ARG@

all: all-redirect

# These programs require only MPI-1 + MPI-I/O
PROGRAMS = read read_at read_all darray subarray ghost \
	hints query levels-darray astro astro-align 
ROUTINES = irreg.o

# These programs require a full MPI-2 or C++ binding for MPI-IO
PROGRAMS2 = view shared interop

SOURCES = astro-align.c astro.c darray.c ghost.c hints.c interop.c \
	  levels-darray.c query.c read.c read_all.c subarray.c view.c \
	  irreg.f read_at.f

all-redirect: ${PROGRAMS} ${ROUTINES}

clean:
	rm -f *.o ${PROGRAMS} *~ PI*
	(cd f90 ; ${MAKE} clean)

.SUFFIXES: .o .c .f .cc .f90
.c:
	${CC} ${CFLAGS} -o $* $< ${LIBS} 
.c.o:
	${CC} ${CFLAGS} -c $<
.f:
	${F77} ${FFLAGS} -o $* $< ${LIBS}
.f.o:
	${F77} ${FFLAGS} -c $<
.f90:
	${F90} ${F90FLAGS} -o $* $< ${LIBS}
.cc:
	${CXX} ${CXXFLAGS} -o $* $< ${LIBS} 

run: ${PROGRAMS}
	${MPIRUN} ${NP_ARG} 4 oned

sources:
	@echo ${SOURCES}
